pub mod assistant;
// pub mod data_channels;
pub mod monitor;
mod net;
pub mod prompts;
// pub mod signaling;
mod starter;
// pub mod transport;
pub use starter::*;

pub use model_graph_channel::data_channels;
pub use model_graph_channel::signaling;
pub use model_graph_channel::transport;

pub use data_channels::proxy::tauri_http_request;
use model_graph_common::utils::rrg01_home_path;

use model_graph_types::database::{ConnectorProtocol, DataSource, DatabaseType};
use sqlite_connector::SqliteConnector;

pub async fn get_system_connector() -> anyhow::Result<SqliteConnector> {
    let data_source = DataSource {
        id: 0,
        database_type: DatabaseType::SQLite,
        protocol: ConnectorProtocol::SQLite,
        url: format!(
            "sqlite:{}/rrg01.sqlite",
            rrg01_home_path()?
                .to_str()
                .map_or(Err(anyhow::anyhow!("")), |s| Ok(s))?
        ),
        username: None,
        password: None,
        options: None,
    };
    tracing::debug!("系统数据库:{:?}", data_source);

    SqliteConnector::open(&data_source).await
}
